package com.kaikai.demo.entity;

import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

//创建excel监听器
public class ExcelListener extends AnalysisEventListener<DemoData> {

List<DemoData> list=new ArrayList<>();
    @Override
    //一行一行读取
    public void invoke(DemoData demoData, AnalysisContext analysisContext) {
        System.out.println(demoData);
        list.add(demoData);
    }
//获取表头信息
    @Override
    public void invokeHeadMap(Map<Integer, String> headMap, AnalysisContext context) {
//        super.invokeHeadMap(headMap, context);
        System.out.println("表头信息"+headMap);
    }


    //读取完成后执行的方法
    @Override
    public void doAfterAllAnalysed(AnalysisContext analysisContext) {

    }
}
